import { createSlice } from "@reduxjs/toolkit";
import type { ISystemMenu } from "@/types/system.interface";

interface SystemState {
  title?: string;
  logo?: string;
  copyright?: string;

  // 系统菜单
  systemMenu: Array<ISystemMenu>;
}

const initialState: SystemState = {
  title: "后台管理系统",
  logo: "/src/assets/images/logo.png",
  copyright: "Copyright © 2025",

  systemMenu: [],
};

export const systemSlice = createSlice({
  name: "system",
  initialState: initialState,
  reducers: {
    // 设置系统菜单
    setMenu: (state, action) => {
      state.systemMenu = action.payload;
    },
  },
});

export const { setMenu } = systemSlice.actions;

export default systemSlice.reducer;
